package com.lw.edu.controller;

import com.lw.commonutil.result.Result;
import com.lw.edu.entity.subject.OneSubject;
import com.lw.edu.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/admin/edu/subject")
public class
SubjectController {
    @Autowired
    private SubjectService subjectService;
    //通过easyexcel上传
    @PostMapping("/addSubject")
    public Result addSubject(MultipartFile file){
        subjectService.addSubject(file);
        return Result.ok();
    }
    //课程分类列表（树形）
    @GetMapping("/getAllSubject")
    public Result getAllSubject(){
        List<OneSubject> list=subjectService.getAllSubject();
        return Result.ok( list );
    }
}
